/*
 * recruiterMainPage.java
 *
 * Created on March 27, 2008, 11:42 PM
 */
import java.sql.SQLException;
import java.util.ArrayList;
import javax.swing.*;
import java.util.Calendar;

/**
 *
 ** @author  Dustin Shiflett
 */
public class recruiterMainPage extends javax.swing.JFrame {
    dbAccess dbLink;
    javax.swing.text.MaskFormatter phoneFmt = null;
    boolean loadedOnce = false;
    boolean searchPopulated = false;
    Boolean[] jobStatusTableSelected = null;
    
    /** Creates new form recruiterMainPage */
    public recruiterMainPage() {
        // A phone number
        try {
            phoneFmt = new javax.swing.text.MaskFormatter("###-###-####");
        } catch (java.text.ParseException e) {
        }
        initComponents();
    }
    
    public void setDB(dbAccess link) {
        dbLink = link;
        updateRecruiterStatusTable();
        loadedOnce = true;
        //JOptionPane.showMessageDialog(null, "dbAccess transferred for: " + dbLink.getEmail());
    }
    
    private void profileTab(){
        String[] profile = new String[6];
        //Profile tab selected, so we need to query DB to display profile info
        submitBtn.setEnabled(true);
        try {
            profile = dbLink.getRecruiterProfile();
            //profile[0] = profile[0].replace(" ", ""); //UNNEEDED-repetetive & causing anomolies
            phoneTxt.setText(profile[0].replace(" ", ""));
            faxTxt.setText(profile[1].replace(" ", ""));
            websiteTxt.setText(profile[2]);
            descriptionTxt.setText(profile[3]);
        } catch (SQLException se) {
            JOptionPane.showMessageDialog(null,
                              new String[] {  // Display a 2-line message
                                  se.getClass().getName() + ": ",
                                  se.getMessage()
                              });
            submitBtn.setEnabled(false);
        }
    }
    
    private boolean verifyEmailSyntax(String email) {
        if(email.isEmpty()) {
            return false;
        }        
        int i = email.indexOf('@');
        if (i > 0) {
            if(email.indexOf('.', i) > 0) {
                return true;
            } else {
                JOptionPane.showMessageDialog(null, "E-mail should be in the format 'a@b.com'.\n" +
                        "The e-mail that was attempted contained '@', but there was no '.' after it.");
            }
        } else {
            JOptionPane.showMessageDialog(null, "E-mail should be in the format 'a@b.com'.\n" +
                        "The e-mail that was attempted did not contain '@'.");
        }
        return false;
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        posTypeBtnGrp = new javax.swing.ButtonGroup();
        tabbedPane = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        closeJobsBtn = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        jobStatusTbl = new javax.swing.JTable();
        jLabel26 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jobTitleTxt = new javax.swing.JTextField();
        emailTxt = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        jobDescriptionTxt = new javax.swing.JTextArea();
        industrySel = new javax.swing.JComboBox();
        testSel = new javax.swing.JComboBox();
        jobPostBtn = new javax.swing.JButton();
        jLabel13 = new javax.swing.JLabel();
        numPositionsSpn = new javax.swing.JSpinner();
        minSalaryTxt = new javax.swing.JFormattedTextField(0);
        jLabel27 = new javax.swing.JLabel();
        minTestScoreSpn = new javax.swing.JSpinner();
        jobPhoneTxt = new javax.swing.JFormattedTextField(phoneFmt);
        jobFaxTxt = new javax.swing.JFormattedTextField(phoneFmt);
        fullTimeBtn = new javax.swing.JRadioButton();
        partTimeBtn = new javax.swing.JRadioButton();
        internshipBtn = new javax.swing.JRadioButton();
        temporaryBtn = new javax.swing.JRadioButton();
        jobLocationTxt = new javax.swing.JTextField();
        jLabel29 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jButton4 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        searchTbl = new javax.swing.JTable();
        jPanel6 = new javax.swing.JPanel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        minDegreeSel = new javax.swing.JComboBox();
        citizenshipSel = new javax.swing.JComboBox();
        jLabel18 = new javax.swing.JLabel();
        bornLowSpn = new javax.swing.JSpinner();
        bornHighSpn = new javax.swing.JSpinner();
        minYrsExpSpn = new javax.swing.JSpinner();
        searchBtn = new javax.swing.JButton();
        clearBtn = new javax.swing.JButton();
        jLabel19 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        websiteTxt = new javax.swing.JTextField();
        jScrollPane4 = new javax.swing.JScrollPane();
        descriptionTxt = new javax.swing.JTextArea();
        submitBtn = new javax.swing.JButton();
        phoneTxt = new javax.swing.JFormattedTextField(phoneFmt);
        faxTxt = new javax.swing.JFormattedTextField(phoneFmt);
        signOutBtn = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        tabbedPane.setFont(new java.awt.Font("Times New Roman", 1, 14));
        tabbedPane.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                tabbedPaneStateChanged(evt);
            }
        });

        jPanel1.setFont(new java.awt.Font("Times New Roman", 1, 14));

        closeJobsBtn.setText("Close job(s)");
        closeJobsBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                closeJobsBtnActionPerformed(evt);
            }
        });

        jobStatusTbl.setBackground(new java.awt.Color(255, 255, 204));
        jobStatusTbl.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jobStatusTblMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(jobStatusTbl);
        tabbedPaneStateChanged(null);

        jLabel26.setText("Jobs status...");

        jLabel28.setText("*Number of Applicants waiting for ");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel26)
                        .addGap(172, 172, 172)
                        .addComponent(jLabel28))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(54, 54, 54)
                        .addComponent(closeJobsBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(58, 58, 58)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 764, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(156, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel26)
                    .addComponent(jLabel28))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(38, 38, 38)
                .addComponent(closeJobsBtn)
                .addContainerGap(246, Short.MAX_VALUE))
        );

        tabbedPane.addTab("Status", jPanel1);

        jLabel1.setText("Industry");

        jLabel2.setText("*Minimum Salary");

        jLabel3.setText("Test");

        jLabel4.setText("Minimum Test Score");

        jLabel5.setText("*Contact Email");

        jLabel6.setText("*Phone");

        jLabel7.setText("Fax");

        jLabel8.setText("Job Description");

        jLabel9.setText("*Position type");

        jLabel10.setText("*Job title");

        jLabel11.setText("Number of positions");

        jLabel12.setText("(Not exceed 500 characters)");

        jobDescriptionTxt.setColumns(20);
        jobDescriptionTxt.setLineWrap(true);
        jobDescriptionTxt.setRows(5);
        jobDescriptionTxt.setWrapStyleWord(true);
        jScrollPane1.setViewportView(jobDescriptionTxt);
        jobDescriptionTxt.setDocument(new JTextFieldLimit(500));

        industrySel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Any", "Accounting", "Automobile", "Computer", "Construction", "Education", "Entertainment", "Fashion", "Government", "Insurance", "Investment", "Medical", "Religious", "Service", "Sales", "Technical" }));

        testSel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "No Test", "GRE", "GMAT", "MCAT", "STAR", "CERT" }));
        testSel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                testSelActionPerformed(evt);
            }
        });

        jobPostBtn.setText("Post Job");
        jobPostBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jobPostBtnActionPerformed(evt);
            }
        });

        jLabel13.setText("*=required");

        SpinnerModel numPosModel = new SpinnerNumberModel(1, //initial value
            1, //min
            999999, //max
            1); //step
        numPositionsSpn.setModel(numPosModel);
        numPositionsSpn.setEditor(new JSpinner.NumberEditor(numPositionsSpn, "#")); //Let the field only accept numeric input

        minSalaryTxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                minSalaryTxtActionPerformed(evt);
            }
        });

        jLabel27.setText("$");

        minTestScoreSpn.setEnabled(false);
        SpinnerModel scoreModel = new SpinnerNumberModel(0, //initial value
            0, //min
            10000, //max
            1); //step
        minTestScoreSpn.setModel(scoreModel);
        minTestScoreSpn.setEditor(new JSpinner.NumberEditor(minTestScoreSpn, "#")); //Let the field only accept numeric input

        jobFaxTxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jobFaxTxtActionPerformed(evt);
            }
        });

        posTypeBtnGrp.add(fullTimeBtn);
        fullTimeBtn.setText("Full time");

        posTypeBtnGrp.add(partTimeBtn);
        partTimeBtn.setText("Part time");

        posTypeBtnGrp.add(internshipBtn);
        internshipBtn.setText("Internship");

        posTypeBtnGrp.add(temporaryBtn);
        temporaryBtn.setText("Temporary");

        jobLocationTxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jobLocationTxtActionPerformed(evt);
            }
        });

        jLabel29.setText("Job Location:");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(33, 33, 33)
                .addComponent(jLabel13)
                .addGap(49, 49, 49)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel29))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel27)
                        .addGap(2, 2, 2)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(minSalaryTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap())
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jobPostBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 286, Short.MAX_VALUE)
                                            .addComponent(emailTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 286, Short.MAX_VALUE)
                                            .addComponent(testSel, 0, 286, Short.MAX_VALUE)
                                            .addComponent(industrySel, 0, 286, Short.MAX_VALUE)
                                            .addGroup(jPanel2Layout.createSequentialGroup()
                                                .addComponent(fullTimeBtn)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(partTimeBtn)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(internshipBtn)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(temporaryBtn)))
                                        .addGap(178, 178, 178)))
                                .addGap(445, 445, 445))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(numPositionsSpn, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap())
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(minTestScoreSpn, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap())
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jobLocationTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap())
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jobTitleTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 242, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap())))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jobPhoneTxt, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jobFaxTxt, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE))
                        .addContainerGap())))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel13)
                            .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jobTitleTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(44, 44, 44))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jobLocationTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel29))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(numPositionsSpn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(industrySel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(fullTimeBtn)
                    .addComponent(partTimeBtn)
                    .addComponent(internshipBtn)
                    .addComponent(temporaryBtn))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(minSalaryTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel27))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(testSel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(minTestScoreSpn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(emailTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addComponent(jobPhoneTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(11, 11, 11)
                        .addComponent(jobFaxTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane1, 0, 0, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jobPostBtn)
                .addGap(6, 6, 6))
        );

        fullTimeBtn.setSelected(true);

        tabbedPane.addTab("Post", jPanel2);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 529, Short.MAX_VALUE)
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 165, Short.MAX_VALUE)
        );

        jButton4.setText("jButton4");

        jButton5.setText("jButton5");

        searchTbl.setBackground(new java.awt.Color(255, 255, 204));
        searchTbl.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Name", "Highest Degree", "Birth Year", "Years of Experience", "Citizenship"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        searchTbl.getTableHeader().setReorderingAllowed(false);
        jScrollPane3.setViewportView(searchTbl);

        jPanel6.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel14.setText("Degree at least");

        jLabel15.setText("Born between");

        jLabel16.setText("Years of experience at least");

        jLabel17.setText("Citizenship");

        minDegreeSel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Not Selected", "PhD", "Specialist", "Master", "Bachelor", "High School or below" }));

        citizenshipSel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Not Selected", "US", "Canadian", "Mexican", "Others" }));

        jLabel18.setText("and");

        //Set possible values
        Calendar calendar = Calendar.getInstance();
        int currentYear = calendar.get(Calendar.YEAR);
        SpinnerModel yearModel = new SpinnerNumberModel(currentYear - 100, //initial value (100-year old)
            currentYear - 250, //min (250 years before today)
            currentYear, //max (this year, though no 0 year old will apply)
            1);                //step
        bornLowSpn.setModel(yearModel);
        bornLowSpn.setEditor(new JSpinner.NumberEditor(bornLowSpn, "#")); //Let the field only accept numeric input

        //Set possible values
        SpinnerModel yearModel2 = new SpinnerNumberModel(currentYear, //initial value (current year)
            currentYear - 250, //min (250 years before today)
            currentYear, //max (this year, though no 0 year old will apply)
            1);                //step
        bornHighSpn.setModel(yearModel2);
        bornHighSpn.setEditor(new JSpinner.NumberEditor(bornHighSpn, "#")); //Let the field only accept numeric input

        SpinnerModel expModel = new SpinnerNumberModel(0, //initial value
            0, //min
            100, //max
            1); //step
        minYrsExpSpn.setModel(expModel);
        minYrsExpSpn.setEditor(new JSpinner.NumberEditor(minYrsExpSpn, "#")); //Let the field only accept numeric input

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(citizenshipSel, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(minDegreeSel, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(minYrsExpSpn, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(bornLowSpn, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE))
                        .addGap(37, 37, 37)
                        .addComponent(jLabel18)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(bornHighSpn, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(minDegreeSel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel18)
                    .addComponent(bornLowSpn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bornHighSpn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(minYrsExpSpn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(citizenshipSel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        searchBtn.setText("Search");
        searchBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                searchBtnActionPerformed(evt);
            }
        });

        clearBtn.setText("Clear");
        clearBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clearBtnActionPerformed(evt);
            }
        });

        jLabel19.setFont(new java.awt.Font("Tahoma", 0, 10));
        jLabel19.setText("Leave blank if unspecified");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(41, 41, 41)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(28, 28, 28)
                        .addComponent(searchBtn)
                        .addGap(47, 47, 47)
                        .addComponent(clearBtn))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jButton4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton5))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(301, 301, 301)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 612, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 0, 0))
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(55, 55, 55)
                .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(745, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(77, 77, 77)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel19)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(32, 32, 32)))
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(clearBtn)
                    .addComponent(searchBtn))
                .addGap(54, 54, 54)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(220, 220, 220)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton4)
                    .addComponent(jButton5))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        tabbedPane.addTab("Search", jPanel3);

        jLabel20.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jLabel20.setText("Update recruiter profile");

        jLabel21.setText("Phone");

        jLabel22.setText("Fax");

        jLabel23.setText("Website");

        jLabel24.setText("Short Description");

        jLabel25.setText("(Not exceed 500 characters)");

        descriptionTxt.setColumns(20);
        descriptionTxt.setLineWrap(true);
        descriptionTxt.setRows(5);
        descriptionTxt.setWrapStyleWord(true);
        jScrollPane4.setViewportView(descriptionTxt);
        descriptionTxt.setDocument(new JTextFieldLimit(500));

        submitBtn.setText("Submit");
        submitBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                submitBtnActionPerformed(evt);
            }
        });

        phoneTxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                phoneTxtActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(27, 27, 27)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 192, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(jLabel24, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jLabel23, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jLabel22, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jLabel21, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE))
                                    .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(faxTxt)
                                    .addComponent(phoneTxt)
                                    .addComponent(jScrollPane4)
                                    .addComponent(websiteTxt)))))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(203, 203, 203)
                        .addComponent(submitBtn)))
                .addGap(875, 875, 875))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(59, 59, 59)
                .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(phoneTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(faxTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(websiteTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(27, 27, 27)
                .addComponent(submitBtn)
                .addContainerGap(162, Short.MAX_VALUE))
        );

        tabbedPane.addTab("Profile", jPanel4);

        signOutBtn.setText("Sign out");
        signOutBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                signOutBtnActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(581, Short.MAX_VALUE)
                .addComponent(signOutBtn)
                .addGap(351, 351, 351))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(tabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 983, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addComponent(signOutBtn)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(109, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jobPostBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jobPostBtnActionPerformed
        // TODO add your handling code here:
        String[] jobData = new String[12];
        boolean inputOK = true;
        
        jobData[0] = jobTitleTxt.getText(); //NEED TO VERIFY EXISTS
        jobData[1] = numPositionsSpn.getValue().toString(); //Will always be >=0
        jobData[2] = industrySel.getSelectedItem().toString(); //Any or selected
        if(internshipBtn.isSelected()) {
            jobData[3] = "Internship";
        } else if (fullTimeBtn.isSelected()) {
            jobData[3] = "Full time";
        } else if (partTimeBtn.isSelected()) {
            jobData[3] = "Part time";
        } else if (temporaryBtn.isSelected()) {
            jobData[3] = "Temporary";
        }
        //jobData[3] = posTypeBtnGrp.getSelection().getText(); //Defaulted to Full Time
        jobData[4] = minSalaryTxt.getText(); //Assume if they leave as 0, they mean it
        jobData[5] = testSel.getSelectedItem().toString(); //No Test or selected
        jobData[6] = minTestScoreSpn.getValue().toString(); //always >=0
        jobData[7] = emailTxt.getText();
        jobData[8] = "000-000-0000"; //unused
        jobData[9] = "000-000-0000"; //unused
        jobData[10] = jobDescriptionTxt.getText(); //Will be null if DNE
        if(jobData[10].isEmpty()) {
            jobData[10] = " ";
        }
        jobData[11] = jobLocationTxt.getText(); //Will be null if DNE
        if(jobData[11].isEmpty()) {
            jobData[11] = " ";
        }
        if(jobData[0].isEmpty()) { //Check job title exists?
            inputOK = false;
            JOptionPane.showMessageDialog(null, "A job title must be provided.\n" +
                    "Job will not be posted.", "Input Verification Failed", 
                    JOptionPane.WARNING_MESSAGE);
        } else { //Job Title exists - Continue checking
            if(!verifyEmailSyntax(jobData[7])) { //Email exists & is in proper format
                inputOK = false;
                JOptionPane.showMessageDialog(null, "A properly formatted email address " +
                        "must be provided.\nJob will not be posted.", 
                        "Input Verification Failed", JOptionPane.WARNING_MESSAGE);
            } //Email exists - Done Checking
        }
        //Mandatory input exists--we can INSERT
        int success = -1;
        try {
            success = dbLink.createNewJob(jobData);
        } catch (SQLException se) {
            JOptionPane.showMessageDialog(null,
                  new String[] {  // Display a 2-line message
                      se.getClass().getName() + ": ",
                      se.getMessage()
                  });
        }
        if ( success > -1) {
            //Worked...clear all our fields & Notify user of success
            JOptionPane.showMessageDialog(null, "Success: Job posted.", 
                    "Job Posted", JOptionPane.INFORMATION_MESSAGE);
            jobTitleTxt.setText("");
            jobLocationTxt.setText("");
            minSalaryTxt.setText("0"); //Assume if they leave as 0, they mean it
            emailTxt.setText(""); //NEED TO VERIFY EXISTS
            jobPhoneTxt.setText(""); //NEED TO VERIFY EXISTS
            jobFaxTxt.setText(""); //Will be _-_-_ if DNE(_ = space)
            jobDescriptionTxt.setText(""); //Will be null if DNE
        } else {
            JOptionPane.showMessageDialog(null, "FAILURE: Job NOT posted.", 
                    "ERROR!", JOptionPane.WARNING_MESSAGE);
        }               
}//GEN-LAST:event_jobPostBtnActionPerformed

    private void clearBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearBtnActionPerformed
        // TODO add your handling code here:
        clearSearchTable();
}//GEN-LAST:event_clearBtnActionPerformed
    
    private void clearSearchTable() {
        searchPopulated = false;
        javax.swing.table.DefaultTableModel model = new javax.swing.table.DefaultTableModel();
        model.addColumn(new String("Name"));
        model.addColumn(new String("Highest Degree"));
        model.addColumn(new String("Birth Year"));
        model.addColumn(new String("Years of Experience"));
        model.addColumn(new String("Citizenship"));
        searchTbl.setModel(model);
    }
    
    private void submitBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitBtnActionPerformed
        // TODO add your handling code here:
        boolean success = false;
        String[] profile = new String[4];
        
        profile[0] = phoneTxt.getText().replace("-", " ");
        profile[1] = faxTxt.getText().replace("-", " ");
        profile[2] = websiteTxt.getText();
        profile[3] = descriptionTxt.getText();
        
        try {
            success = dbLink.updateRecruiterProfile(profile);
        } catch (SQLException se) {
            JOptionPane.showMessageDialog(null,
			          new String[] {  // Display a 2-line message
				      se.getClass().getName() + ": ",
				      se.getMessage()
				  });
        }
        if (!success) {
            JOptionPane.showMessageDialog(null, "Recruiter profile update failed!");
        }
}//GEN-LAST:event_submitBtnActionPerformed

    private void signOutBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_signOutBtnActionPerformed
        // TODO add your handling code here:
        dbLink.close();
        welcome dialog = new welcome(new javax.swing.JFrame(), true);
        dialog.addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent e) {
                System.exit(0);
            }
        });
        loadedOnce = false;
        dispose();
        dialog.setVisible(true);
    }//GEN-LAST:event_signOutBtnActionPerformed

    private void phoneTxtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_phoneTxtActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_phoneTxtActionPerformed

    private void tabbedPaneStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_tabbedPaneStateChanged
        // TODO add your handling code here:
        int sel = tabbedPane.getSelectedIndex();
        //DEBUG MSG: //JOptionPane.showMessageDialog(null,"Pane " + sel + " selected.");
        if (sel == 0) { //Status tab
            if (loadedOnce) {
                updateRecruiterStatusTable();
            }
        } else if (sel == 1) { //Post tab
            
        } else if (sel == 2) { //Search tab
            
        } else if (sel == 3) { //Profile tab
            profileTab();
        }
}//GEN-LAST:event_tabbedPaneStateChanged
    
    private void updateRecruiterStatusTable() {
        try {
                javax.swing.table.TableModel newModel = dbLink.getRecruiterStatusTable();
                if (newModel == null) {
                    throw new IllegalStateException("dbAccess didn't do a good job with getRecruiterStatusTable()..." + 
                                "SQL DB access probably failed for some reason");
                } else {
                    jobStatusTableSelected = new Boolean[newModel.getRowCount()];
                }
                //JOptionPane.showMessageDialog(null, "model created.");
                jobStatusTbl.setModel(newModel);
                } catch (SQLException se) {
                    JOptionPane.showMessageDialog(null,
                                      new String[] {  // Display a 2-line message
                                          se.getClass().getName() + ": ",
                                          se.getMessage()
                                      });
                }
        for(int i=0; i < jobStatusTableSelected.length; i++) {
            jobStatusTableSelected[i] = false;
        }
        jobStatusTbl.getTableHeader().setReorderingAllowed(false);
    }
    
    private void minSalaryTxtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_minSalaryTxtActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_minSalaryTxtActionPerformed

    private void jobFaxTxtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jobFaxTxtActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jobFaxTxtActionPerformed

    private void testSelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_testSelActionPerformed
        // TODO add your handling code here:
        if(testSel.getSelectedIndex() == 0) {
            minTestScoreSpn.setEnabled(false);
        } else {
            minTestScoreSpn.setEnabled(true);
        }
    }//GEN-LAST:event_testSelActionPerformed

    private void searchBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchBtnActionPerformed
        // TODO add your handling code here:
        String query = "SELECT APPLICANT_ID, A_NAME, HIGHEST_DEGREE, " +
                "YEARS_OF_EXPERIENCE, CITIZENSHIP, to_char(BIRTH_YEAR, 'YYYY') " +
                "FROM ops$gtg624x.APPLICANT a WHERE";
        String citizenshipQuery = null, minYrsExpQuery = null, birthRangeQuery, minEduQuery = null;
        boolean needCitizenship = false;
        //boolean needBirthRange = false; //Always will include this and WHERE
        boolean needMinEdu = false;
        boolean needMinYrsExp = false; 
        int maxBirthYr, minBirthYr, minYrsExp, minEdu;
        
        String citizenship = citizenshipSel.getSelectedItem().toString();
        if (citizenship.equals("Not Selected")) {
            //We don't need to include anything about citizenship in our query
        } else { //We Do need citizenship constraints in our query
            needCitizenship = true;
            citizenshipQuery = "CITIZENSHIP = '" + citizenship + "'";
        } //Citizenship query set-up
        
        minYrsExp = Integer.parseInt(minYrsExpSpn.getValue().toString());
        if (minYrsExp > 0) {
            //We need to include min yrs exp. constraint in query
            minYrsExpQuery = "YEARS_OF_EXPERIENCE >= " + minYrsExp;
            needMinYrsExp = true;
        } //min experience query set-up
        
        minBirthYr = Integer.parseInt(bornLowSpn.getValue().toString());
        maxBirthYr = Integer.parseInt(bornHighSpn.getValue().toString());
        if (minBirthYr > maxBirthYr) { //Make sure we have the smallest value in min
            int temp = minBirthYr;
            minBirthYr = maxBirthYr;
            maxBirthYr = temp;
        }
        birthRangeQuery = "BIRTH_YEAR between to_date('" + minBirthYr + "', 'YYYY') " +
                "and to_date('" + maxBirthYr + "', 'YYYY')";
        //birth range query set-up
        
        minEdu = minDegreeSel.getSelectedIndex();
        minEduQuery = new String();
        
        if(minEdu > 0 && minEdu < 5) { //Don't worry about this if we are willing to take high school or below or haven't selected anything
            for(int i = minEdu; i > 0; i--) {
                //System.out.println(minDegreeSel.getItemAt(i).toString());
                minEduQuery = minEduQuery.concat("HIGHEST_DEGREE = '" + 
                        minDegreeSel.getItemAt(i).toString() + "'");
                if(i != 1) {
                    minEduQuery = minEduQuery.concat(" OR ");
                }
            }
            needMinEdu = true;
        } //Done with minEduQuery
        
        //Now we need to construct the entire query
        query = query.concat(" " + birthRangeQuery);
        if(needCitizenship) {
            query = query.concat(" " + citizenshipQuery);
        }
        if(needMinEdu) {
            query = query.concat(" " + minEduQuery);
        }
        if(needMinYrsExp) {
            query = query.concat(" " + minYrsExpQuery);
        }
        //System.out.println(query);
        try {
            javax.swing.table.TableModel model = dbLink.searchApplicants(query);
            searchTbl.setModel(model);
            if(model.getRowCount() > 0) {
                searchPopulated = true;
            }
        } catch ( SQLException se) {
            JOptionPane.showMessageDialog(null,
                                      new String[] {  // Display a 2-line message
                                          se.getClass().getName() + ": ",
                                          se.getMessage()
                                      });
        }
    }//GEN-LAST:event_searchBtnActionPerformed


    private void jobStatusTblMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jobStatusTblMouseClicked
        // TODO add your handling code here:
        int col = jobStatusTbl.getSelectedColumn();
        int row = jobStatusTbl.getSelectedRow();
        if (col == 0) { //User probably changed which Jobs are selected to be closed
            jobStatusTableSelected[row] = (Boolean)jobStatusTbl.getModel().getValueAt(row, 0);
        } else if (col == 2) { //User clicked on a Job Title, need to open JobApplications page (B4)
            openJobApplicationStatusPage(Integer.parseInt(jobStatusTbl.getModel().getValueAt(row, 1).toString()), 
                    jobStatusTbl.getModel().getValueAt(row, 2).toString());
        }
    }//GEN-LAST:event_jobStatusTblMouseClicked

    private void jobLocationTxtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jobLocationTxtActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jobLocationTxtActionPerformed

    private void closeJobsBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeJobsBtnActionPerformed
        // TODO add your handling code here:
        //for(int i=0; jobStatusTableSelected)
    }//GEN-LAST:event_closeJobsBtnActionPerformed
    
    private void displayApplicantProfile(int index) {
        String[] applicantData = null;
        String[] msgData = new String[9];
        try {
            applicantData = dbLink.getApplicantProfileForRecruiter(index);
        } catch (SQLException se) {
            JOptionPane.showMessageDialog(null,
                                      new String[] {  // Display a 2-line message
                                          se.getClass().getName() + ": ",
                                          se.getMessage()
                                      });
        }
        if(applicantData != null) {
            Calendar calendar = Calendar.getInstance();
            int currentYear = calendar.get(Calendar.YEAR);
            int age = currentYear - Integer.parseInt(applicantData[7]);
            
            msgData[0] = "Applicant Detail";
            msgData[1] = "Name: " + applicantData[0];
            msgData[2] = "Email: " + applicantData[1];
            msgData[3] = "Phone: " + applicantData[2];
            msgData[4] = "Highest Degree: " + applicantData[3];
            msgData[5] = "Age: " + age;
            msgData[6] = "Years of Experience: " + applicantData[4];
            msgData[7] = "Citizenship: " + applicantData[5];
            msgData[8] = "Description: " + applicantData[6];
            
            JOptionPane.showMessageDialog(null, msgData);
        }
    }
    
    private void openJobApplicationStatusPage(int jobID, String jobTitle) {
        jobApplications dialog = new jobApplications(); 
        dialog.addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent e) {
                //System.exit(0); //Do not need to exit if user clicks the X on this window
            }
        });
        dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
        dialog.setDB(dbLink);
        dialog.setParentDialog(this);
        dialog.setJobInfo(jobID, jobTitle);
        this.setEnabled(false);
        this.setVisible(false);
        dialog.setVisible(true);
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new recruiterMainPage().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JSpinner bornHighSpn;
    private javax.swing.JSpinner bornLowSpn;
    private javax.swing.JComboBox citizenshipSel;
    private javax.swing.JButton clearBtn;
    private javax.swing.JButton closeJobsBtn;
    private javax.swing.JTextArea descriptionTxt;
    private javax.swing.JTextField emailTxt;
    private javax.swing.JFormattedTextField faxTxt;
    private javax.swing.JRadioButton fullTimeBtn;
    private javax.swing.JComboBox industrySel;
    private javax.swing.JRadioButton internshipBtn;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JTextArea jobDescriptionTxt;
    private javax.swing.JFormattedTextField jobFaxTxt;
    private javax.swing.JTextField jobLocationTxt;
    private javax.swing.JFormattedTextField jobPhoneTxt;
    private javax.swing.JButton jobPostBtn;
    private javax.swing.JTable jobStatusTbl;
    private javax.swing.JTextField jobTitleTxt;
    private javax.swing.JComboBox minDegreeSel;
    private javax.swing.JFormattedTextField minSalaryTxt;
    private javax.swing.JSpinner minTestScoreSpn;
    private javax.swing.JSpinner minYrsExpSpn;
    private javax.swing.JSpinner numPositionsSpn;
    private javax.swing.JRadioButton partTimeBtn;
    private javax.swing.JFormattedTextField phoneTxt;
    private javax.swing.ButtonGroup posTypeBtnGrp;
    private javax.swing.JButton searchBtn;
    private javax.swing.JTable searchTbl;
    private javax.swing.JButton signOutBtn;
    private javax.swing.JButton submitBtn;
    private javax.swing.JTabbedPane tabbedPane;
    private javax.swing.JRadioButton temporaryBtn;
    private javax.swing.JComboBox testSel;
    private javax.swing.JTextField websiteTxt;
    // End of variables declaration//GEN-END:variables
    
}
